Repository navigation
Conversation
The retry after a 401 went out under the anonymous request's id with its last byte bumped. RFC 8489 §6 wants every new transaction under a fresh, cryptographically random 96-bit id, and the retry is a new transaction. The risk was small — whoever could predict the id had seen the first request — but the rule also forced allocate() to foretell its own retry, and webrtc-rs#281 had to special-case the timeout and the error exit so that they named that foretold id rather than the one on the wire. The retry now carries TransactionId::new(), as every other request does, and the transaction remembers which allocation it belongs to: TransactionType::AllocateRequest holds the id allocate() returned next to the nonce, and the response, error and timeout handlers report that id. allocate() returns the anonymous request's own id, so an error or a timeout on the first request names the wire id as it is, and authenticated_allocate_id() and both special cases go away. Nothing visible to a caller changes: every event about an allocation still names the id allocate() handed out, which is what webrtc's relayer and the examples match on. The test drives a 401 with nonce and realm, reads the retry off the wire and asserts its id differs from the anonymous one in more than its last byte; then answers it with a success, with a 403, and with nothing, and asserts each event names the id allocate() returned. The webrtc-rs#281 tests pass unchanged. Follow-up to webrtc-rs#281, as discussed there.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #332 +/- ##
==========================================
+ Coverage 88.47% 88.54% +0.06%
==========================================
Files 512 512
Lines 75483 75589 +106
==========================================
+ Hits 66787 66929 +142
+ Misses 8696 8660 -36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #281, as agreed in its review thread.
The authenticated Allocate retry after a 401 went out under the anonymous request's id with
its last byte bumped. RFC 8489 §6 wants every new transaction under a fresh random 96-bit id,
and the retry is a new transaction. The predictable id was a small risk on its own, but it also
made
allocate()foretell its own retry id, which is why #281 had to special-case the timeoutand the nonce-less error exit.
What changes:
TransactionId::new(), like every other request.TransactionType::AllocateRequestremembers the idallocate()returned next to the nonce,and the response, error and timeout handlers report that id.
allocate()returns the anonymous request's own id, soauthenticated_allocate_id()and bothspecial cases from fix(turn): report an Allocate timeout under the id allocate() returned #281 go away.
allocate()handed out, which is what webrtc's relayer and the examples match on.
Testing:
off the wire, and assert its id differs from the anonymous one in more than the last byte.
Then answer it with a success, a 403 and silence, and assert each event names the id
allocate()returned. It was red before the change: the first 11 bytes matched.TransactionType::AllocateRequestdirectly were updated to the struct variant.
rtc-turn: 52 lib tests pass on current master.cargo fmtis clean, and so iscargo clippy -p rtc-turn --lib -D warnings.examples/turn_client_udp: coturn logsthe 401 on the anonymous Allocate, then
ALLOCATE processed, successon the random-id retry,and the example's
assert_eq!(tid, allocate_tid)holds. From webrtc with this commit in thesubmodule,
turn_over_tcpandturn_credential_rotationboth pass against the same server.